fix: 린트가 객체로 봉인하라는데 스키마는 문자열만 받고 있었다 (v0.2.13) - #47
Merged
Conversation
`mm_preregister` 가 게시하는 스키마는 `pre_seal_checks: {items:{"type":"string"}}`
였다. `list[str]` 힌트에서 FastMCP 가 성실히 유도한 값인데, measure-mirror 본문은
오래전에 그 힌트를 넘어섰다.
그래서 ⑫h 조언 — *"Seal each as an object instead: {'name':…, 'result':…}"* — 을
따르려는 호출자는 함수에 닿기도 전에 pydantic 에서 튕긴다:
`Input should be a valid string [type=string_type]`.
우회도 막혔다. 결과를 문자열에 적으면(`"neutral-control: not_fired — 30 runs"`)
① WARN 은 그대로다 — 린트는 **bare 문자열이라는 사실**에 걸지 내용에 걸지 않는다.
② 게다가 그 이름이 인식 불가가 되어 감사가 이름으로 못 센다.
모든 길이 막다른 길이고, **행동할 수 없는 WARN 은 읽는 쪽이 건너뛰는 법을 배운다** —
그게 진짜 손실이다.
08-26 다른 레인이 신고했다. 그쪽은 객체를 시험하지 못했다 — 봉인이 append-only 라
실패한 시도를 원장에 남기고 싶지 않아서다. 08-28 에 재현·실측했다.
🔴 거절은 검증 층에서 나므로 **아무것도 안 쓰인다** — 원장 파일조차 안 생겼다.
그 두려움은 근거가 없었고, 그 두려움이 이 인터페이스를 이틀간 미측정으로 남겼다.
수리: 힌트를 `list[str | dict] | None` 로. 툴 설명에 객체 형태를 적었다.
시험 3건 신설 — **함수가 아니라 wire 를 잰다**.
기존 시험은 전부 툴을 평범한 파이썬 함수로 호출한다. MCP 검증 층을 통째로 건너뛴다.
🔴 그래서 이게 출하됐다 — `test_prereg_lint_clean_seal_has_no_warn_or_fail` 은
**이미 객체를 넣고 초록이었다**. 실제 클라이언트는 전부 거절당하는 동안에.
새 시험은 서버 자신의 arg model 로 검증하고, 게시된 스키마에 object 가 보이는지 본다.
🔬 그중 하나는 **계기의 양성대조**다 — 같은 payload 가 옛 힌트에선 거절되는지 본다.
없으면 나머지 둘이 아무것도 검증 안 해도 초록으로 남는다. 커밋 전에 옛 힌트로
되돌려 둘 다 실제로 FAIL 하는 것을 확인했다.
pytest 62 통과(파이프 없이 · exit 0).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
한 줄
mm_preregister의 게시 스키마가pre_seal_checks를 문자열 배열로 선언해, 자기 린트(⑫h)가 권하는 객체를 호출 전에 튕겼다.실측 (08-28)
WARN ⑫hWARN ⑫h+ 이름 전부 unrecognisedInput should be a valid string [type=string_type]_bare=False로 회수세 길이 전부 막다른 길이었다. 행동할 수 없는 WARN 은 읽는 쪽이 건너뛰는 법을 배운다 — 그게 진짜 손실이다.
🔴 거절은 pydantic 검증 층에서 나므로 원장에 아무것도 안 쓰인다. 원장 파일조차 안 생겼다(확인함). 신고 레인은 "append-only 라 실패한 시도를 남길까 봐" 객체를 시도하지 않았는데 — 그 두려움이 이 인터페이스를 미측정으로 남긴 유일한 이유였다.
수리
pre_seal_checks: list[str] | None→list[str | dict] | None. FastMCP 가 유도하는 스키마가anyOf: [string, object]로 바뀐다.시험 — 함수가 아니라 wire 를 잰다
🔴 이 결함이 출하된 이유가 시험에 있다. 기존 시험은 전부 툴을 평범한 파이썬 함수로 호출한다. MCP 검증 층을 통째로 건너뛴다. 그래서:
신설 3건:
arg_model로 객체 payload 를 검증한다(실제로 거는 관문).object가 보이는지 본다 — 클라이언트가 읽는 것. 스키마를 믿는 클라이언트는 애초에 객체를 안 보낸다.양성대조가 왜 필요한가: 없으면 1·2 가 아무것도 검증 안 해도 초록으로 남는다. 커밋 전에 옛 힌트로 실제로 되돌려 둘 다 FAIL 하는 것을 확인했다:
상류
힌트의 뿌리는 measure-mirror 의
preregister시그니처다 — mirror-stack/measure-mirror#72 에서 같이 고친다. 다만 이 레포의 스키마는 자기server.py시그니처에서 나오므로 이 PR 은 그 PR 과 독립이다(핀 갱신 불필요).시험 62 통과(파이프 없이 · exit 0).